//
//  ZTYTextField.swift
//  AreaChainblock
//
//  Created by 赵佟越 on 2018/9/20.
//  Copyright © 2018年 zhaotongyue. All rights reserved.
//

import UIKit



class ZTYTextField: UITextField {
    
    //swift的二次构造
    
    override init(frame: CGRect) {
        
        super.init(frame: frame)
        
    }
    
    //便利构造 重写 init方法
    
    
    
    
    convenience  init( leftView: UIView?,frame: CGRect, rightView: UIView?, color:UIColor?,boardWidth:CGFloat,boardRadius : CGFloat)
        
    {
        
        self.init(frame:frame)
        
        self.leftViewMode = UITextFieldViewMode.always
        
        self.leftViewMode = UITextFieldViewMode.always
        
        let leftView = UIView(frame: CGRect(x: 0, y: 0, width: 8, height: 0))
//            [[UIView, alloc]initWithFrame:CGRectMake(0, 0, 8, 0)];
        self.leftView = leftView
        
        self.rightView = rightView
        
//        if color == nil
        
//        {
        
            //默认一个颜色
            
//            color = UIColor(red: 0.2588, green: 0.7490, blue: 0.6471, alpha: 1)
//
//        }
        
        self.layer.borderColor = UIColor.white.cgColor as! CGColor
        
        //边框宽度
        
        self.layer.borderWidth = boardWidth
        
        self.layer.masksToBounds = true
        
        //边框圆角
        
        self.layer.cornerRadius = boardRadius
        
    }
    
    required init(coder aDecoder: NSCoder) {
        
        fatalError("init(coder:) has not been implemented")
        
    }
    
}
